extends Node2D

signal plant_select(str: String)

var texture1: ImageTexture
var texture2: ImageTexture

@export var plant_name = "sunflower"

# Called when the node enters the scene tree for the first time.
func _ready():
	set_plant_card(plant_name)
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	var speed = 10
	var velocity = Vector2(0, speed)
	if $CardMask.size.y < 70:
		$CardMask.size += velocity*delta
	pass


func _on_link_button_pressed():
	$TextureRect.texture = texture2
	plant_select.emit(plant_name)
	#print("press")
	pass # Replace with function body.

func set_plant_card(str: String):
	plant_name = str
	texture1 = ImageTexture.create_from_image(
		Image.load_from_file("res://images/card/card_"+str+".png"))
	texture2 = ImageTexture.create_from_image(
		Image.load_from_file("res://images/card/card_"+str+"2.png"))
	$TextureRect.texture = texture1
	pass
